package com.zhoutian.controller;

import com.zhoutian.entity.Message;
import com.zhoutian.entity.User;
import com.zhoutian.service.AnnounceService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/announce")
@Slf4j
@CrossOrigin
public class AnnounceController {

    @Autowired
    private AnnounceService announceService;

    @PostMapping("/save")
    public Map<String, Object> save (Message message) {
        Map<String, Object> map = new HashMap<>();
        if (announceService.save(message)) {
            map.put("status", true);
        } else {
            map.put("status", false);
        }
        return map;
    }
}
